home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-07-06 | 1.8 KB | 82 lines | [TEXT/MSET] |
- \ Various utilities
-
-
- \ Class RES+ adds methods to Resource to allow various modifications
- \ to resources. We'll put more in as we need them.
-
- : CHK word0 call reserror i->l ?dup 0EXIT
- ." resource error# " . ;
-
-
- :class RES+ super( resource )
-
- :m CHANGED:
- get: self call ChangedResource ;m
-
- :m ADD: { addr len -- }
- get: self
- get: resType get: ID makeint
- addr len str255 call AddResource chk ;m
-
- :m REMOVE:
- get: self call RmveResource chk ;m
-
- :m SETATTRS: \ ( n -- )
- get: self swap makeint call SetResAttrs chk
- changed: self ;m
-
- ;class
-
- string TEMP$
- res+ TEMPRES
-
-
- : (.MOD) { theCfa size \ modObj -- }
- theCfa mod? NIF drop EXIT THEN
- >obj -> modObj
- cr 0 -> out .id: [ modObj ]
- 15 out - spaces
- base: [ modObj ] dup
- NIF drop ." not loaded" ELSE u.h THEN
- keep?: [ modObj ] IF type# 174 ( *** Keep *** ) THEN
- locked?: [ modObj ] IF type# 175 ( *** Locked *** ) THEN ;
-
- : .MODS \ Lists modules and their load status.
- curs -curs
- ['] (.mod) 0 trav
- -> curs cr ; \ 31Jan94 DBH End with a cr Better for TW
-
-
- : .MSGS \ Lists all error etc. messages and their numbers.
- 300 -60 DO
- ?pause cr
- i . space i getstring
- dup IF type ELSE 2drop THEN
- LOOP ;
-
-
- : ADDMSG { msg# addr len -- }
- msg# getstring abort" number already assigned" drop
- addr pad 1+ len cmove
- len pad c!
- new: temp$
- pad len 1+ put: temp$
- 'type STR msg# set: tempRes handle: temp$ put: tempRes
- 0 0 add: tempRes
- $ 20 setAttrs: tempRes ;
-
- : REMOVEMSG { msg# -- }
- msg# getstring nip 0EXIT
- 'type STR msg# set: tempRes getnew: tempRes
- remove: tempRes release: tempRes ;
-
-
- : GETINDSTR { resID idx \ addr -- addr len }
- openMR
- 'type STR# resID getRes dup NIF 0 EXIT THEN
- ( handle ) @ -> addr
- idx addr w@ >= IF 0 0 EXIT THEN
- 2 ++> addr
- idx 0 ?DO addr count + -> addr LOOP
- addr count ;
-